<template>
  <div class="login">
    <el-form ref="ruleForm" :model="name" :rules="rules" class="login-form">
      <h3 class="title">电台测试系统</h3>
      <!-- 用户名 -->
      <el-form-item>
        <el-input v-model="name.username">
        </el-input>
      </el-form-item>
      <!-- 密码 -->
      <el-form-item>
        <el-input v-model="name.password"></el-input>
      </el-form-item>
      <!-- 按钮 -->
      <el-form-item style="width: 100%">
        <el-button type="primary" size="medium" style="width:100%;" @click="submitForm">登录</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
  data() {
    return {
      name: {
        username: "admin",
        password: "123456",
      },
      rules: {
        username: [
          { required: true, message: "请输入登录名称", trigger: "blur" },
          { min: 3, max: 6, message: "长度在 3 到 6 个字符", trigger: "blur" },
        ],
        password: [
          { required: true, message: "请输入登录密码", trigger: "blur" },
          {
            min: 6,
            max: 45,
            message: "长度在 6 到 15 个字符",
            trigger: "blur",
          },
        ],
      },
    };
  },
  methods: {
    // 登录按钮
    submitForm(){
      this.$router.push("/home")
    }
  },
};
</script>

<style lang="less" scoped>
.login {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  background-image: url("../assets/login.jpg");
  background-size: cover;
}
.title {
  margin: 0px auto 30px auto;
  text-align: center;
  color: #707070;
}

.login-form {
  border-radius: 6px;
  background: #ffffff;
  width: 400px;
  padding: 25px 25px 5px 25px;
  .el-input {
    height: 38px;
    input {
      height: 38px;
    }
  }
}
</style>